-
-
Notifications
You must be signed in to change notification settings - Fork 195
London | ITP-May-2025 | Seddiq Azam | Module-Structuring-and-Testing-Data | Sprint-3 #621
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
modified: Sprint-3/2-mandatory-rewrite/1-get-angle-type.js
modified: Sprint-3/2-mandatory-rewrite/1-get-angle-type.test.js
modified: Sprint-3/2-mandatory-rewrite/1-get-angle-type.test.js
modified: Sprint-3/2-mandatory-rewrite/2-is-proper-fraction.test.js
modified: Sprint-3/2-mandatory-rewrite/3-get-card-value.test.js
modified: Sprint-3/3-mandatory-practice/implement/count.test.js
modified: Sprint-3/3-mandatory-practice/implement/get-ordinal-number.test.js
modified: Sprint-3/3-mandatory-practice/implement/repeat.test.js
new file: package-lock.json modified: package.json
// if (numerator > denominator) return false; | ||
// if (numerator === denominator) return false; | ||
if (denominator === 0) throw new Error("Denominator cannot be zero"); | ||
if (numerator * denominator <= 0) return false; // Check for negative fractions or zero |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In mathematics, -A/B == A/-B == -(A/B), and -A/-B == A/B for any integers A and B (B ≠ 0).
They represent a proper fraction if A < B and A ≠ 0 and B ≠ 0.
-2/3 is considered a proper fraction.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You haven't made any change to your code.
isProperFraction(-2, 3)
should return true
.
Sprint-3/3-mandatory-practice/implement/get-ordinal-number.test.js
Outdated
Show resolved
Hide resolved
let result; | ||
if (num === 1) { | ||
return "1st"; | ||
} else if (num === 2) { | ||
return "2nd"; | ||
} else if (num === 3) { | ||
return "3rd"; | ||
} else if (num >= 4 && num <= 20) { | ||
return num + "th"; | ||
} else if (num % 10 === 1) { | ||
// % gives the last digit of the number | ||
return num + "st"; | ||
} else if (num % 10 === 2) { | ||
return num + "nd"; | ||
} else if (num % 10 === 3) { | ||
return num + "rd"; | ||
} | ||
const s = ["th", "st", "nd", "rd"]; | ||
const v = num % 100; // Get the last two digits of the number | ||
result = num + (s[(v - 20) % 10] || s[v] || s[0]); // Determine the correct suffix based on the last two digits |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-
The ordinal of 111 is "111th".
-
Can you explain how the code at line 24 works?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you also address this comment and question?
-
The ordinal of 111 is "111th" (Can you check what your function returns when
num
is 111?) -
Can you explain how the code at line 24 works?
…angle Sprint-3/2-mandatory-rewrite/1-get-angle-type.js
…te/3-get-card-value.js modified: Grouped multi tests Sprint-3/2-mandatory-rewrite/3-get-card-value.test.js modified: Answered questions Sprint-3/3-mandatory-practice/implement/get-ordinal-number.test.js
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you also practice responding to comments directly in the comment threads? It could make tracking the discussion easier.
Here is a simplified version of best practices ChatGPT suggested for responding to inline comments in a pull request:
- ✅ Reply to every comment – Let the reviewer know you saw it.
- ✏️ Make the change if needed – Fix the code if the comment points out a real issue.
- 🤔 Explain if you don't agree – If you think the code is fine, politely explain why.
- ✅ Mark as resolved when done – Only mark comments resolved after you fix or respond.
- 💬 Keep replies short and polite – Be respectful and to the point.
- ⏱️ Respond soon – Don’t wait too long to reply.
- 🧪 Test your changes – Make sure your fixes actually work.
- 📍 Reply directly under the comment – This keeps the conversation easy to follow.
Sprint-3/3-mandatory-practice/implement/get-ordinal-number.test.js
Outdated
Show resolved
Hide resolved
let result; | ||
if (num === 1) { | ||
return "1st"; | ||
} else if (num === 2) { | ||
return "2nd"; | ||
} else if (num === 3) { | ||
return "3rd"; | ||
} else if (num >= 4 && num <= 20) { | ||
return num + "th"; | ||
} else if (num % 10 === 1) { | ||
// % gives the last digit of the number | ||
return num + "st"; | ||
} else if (num % 10 === 2) { | ||
return num + "nd"; | ||
} else if (num % 10 === 3) { | ||
return num + "rd"; | ||
} | ||
const s = ["th", "st", "nd", "rd"]; | ||
const v = num % 100; // Get the last two digits of the number | ||
result = num + (s[(v - 20) % 10] || s[v] || s[0]); // Determine the correct suffix based on the last two digits |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you also address this comment and question?
-
The ordinal of 111 is "111th" (Can you check what your function returns when
num
is 111?) -
Can you explain how the code at line 24 works?
…/implement/get-ordinal-number.test.js
…2-mandatory-rewrite/2-is-proper-fraction.js modified: Sprint-3/2-mandatory-rewrite/2-is-proper-fraction.test.js
modified: Sprint-3/2-mandatory-rewrite/3-get-card-value.test.js
Changes look good. Well done! |
Learners, PR Template
Self checklist
Changelist
Briefly explain your PR.
This PR includes updates and changes made across multiple Sprint 3 exercises, which include:
1-get-angle-type.js
Improved logic clarity and added corresponding test updates.
2-is-proper-fraction.js
Refined logic to correctly handle negative values and exceptional cases (e.g.,
-3/-4
as a proper fraction).3-get-card-value.js
Enhanced handling for edge cases and improved code readability.
Practice Implementations
Added and updated various files (e.g.,
count.js
,get-ordinal-number.js
,repeat.js
) to meet assignment requirements and ensure consistent behaviour.All updated files were tested to ensure correctness and alignment with the task specifications.
Questions
Ask any questions you have for your reviewer.